//package cn.flying.cloud.esb.core.camel.route;
//
//import javax.annotation.Resource;
//
//import org.apache.camel.Exchange;
//import org.apache.camel.builder.RouteBuilder;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.context.ApplicationContext;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import cn.flying.cloud.base.common.utils.Ft;
//import cn.flying.cloud.base.common.vo.Rt;
//import cn.flying.cloud.esb.core.camel.constants.CamelConstant;
//import cn.flying.cloud.esb.core.camel.process.ConvertDataProcessor;
//import cn.flying.cloud.esb.core.camel.process.ExceptionProcessor;
//import cn.flying.cloud.esb.core.camel.process.ForwardResolverProcessor;
//import cn.flying.cloud.esb.core.camel.process.HttpMethodProcessor;
//import cn.flying.cloud.esb.core.camel.process.ParamValidProcessor;
//import cn.flying.cloud.esb.core.enums.ErrorCodeEnum;
//import cn.flying.cloud.esb.core.exception.EsbException;
//import cn.flying.cloud.esb.model.ApiRequest;
//
///**
// * camel http route 配置
// *
// * @author: admin
// * @date: 2025年04月10日 14:14
// * @version: 1.0
// */
//@Configuration
//public class HttpRoute {
//    private final Logger logger = LoggerFactory.getLogger(this.getClass());
//
//    @Resource
//    private ApplicationContext applicationContext;
//
//    @Bean
//    public RouteBuilder routeBuilder() {
//        return new RouteBuilder() {
//            @Override
//            public void configure() throws Exception {
//                // 全局异常处理器
//                onException(Exception.class)
//                        .handled(true)
//                        .process(new ExceptionProcessor(applicationContext));
//
//                // 定义接收
//                from("undertow:http://0.0.0.0:30000/api/esb")
//                        .process(new HttpMethodProcessor())
//                        .process(new ParamValidProcessor(applicationContext))
//                        .process(new ForwardResolverProcessor(applicationContext))
//                        // 将客户端请求参数传递到三方服务
//                        .process(new ConvertDataProcessor(applicationContext))
////                        .to("http://localhost:10001/system/dict?type=service_name&bridgeEndpoint=true")
//                        // 根据消息头中的转发地址进行动态转发，并设置 bridgeEndpoint=true
//                        .toD("${header.forwardUrl}")
//                        // 根据局部变量中的转发地址进行动态转发，并设置 bridgeEndpoint=true
////                        .toD("${exchangeProperty.forwardUrl}")
//                        .process(exchange -> {
//                            // 移除包含动态端点地址的消息头
//                            exchange.getIn().removeHeader("forwardUrl");
//                        }).setHeader("Content-Type", constant("application/json"));
//            }
//        };
//    }
//}